package henu.util;

import henu.DB.DB;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
public class ChatUtil {
	 public static String renderChatroom(){
	        List result = new ArrayList();
	        String sql= "select * from chat";
	        ResultSet rs = DB.RunSelect(sql);
	        
	        Chat chat = new Chat(0);
	        try{
	            while(rs.next()){
	                chat = new Chat(rs.getInt("CHAT_ID"));
	                result.add(chat);
	            }
	        }catch(Exception e){
	            e.printStackTrace();
	        }
	        StringBuffer buf = new StringBuffer();
//	        buf.append("<select name="+roomlist+" size="5" class="textInput">");
	        for(int i=0;i<result.size();i++){
	            Chat c = (Chat)result.get(i);
//	            buf.append("<option value=""+c.getChatID()+"">"+c.getChatName()+"</option>");
	            
	        }
	        buf.append("</select>");
	        DB.getConnection();
	    return buf.toString();    
	    }
	}
